package com.example.demo1.user.entity;

import com.example.demo1.utils.ImageUntil;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.Border;
import javafx.scene.layout.GridPane;

/**
 * 用于绘制各种图形的类
 */
public class Painter {
    private Canvas canvas;
    private Background background;

    public Painter(Canvas canvas) {
        this.canvas = canvas;
        background = new Background(0, 0, 800, 600);
    }

    public void paintBackground(Canvas canvas) {
        String gs2 = "/image/game/gameBackground/grassSpace2.png";
        GraphicsContext g2d = canvas.getGraphicsContext2D();
        g2d.drawImage(ImageUntil.getImage(gs2), 0, 0, 800, 600);

    }

    // 开始绘画
    public void start(Canvas canvas) {
    }

    // 清空当前画布
    public void clean() {
        canvas.getGraphicsContext2D().clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
    }
}
